package DoubanMovie_2;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        List<Movie> movie = new ArrayList<>();
        movie.add(new DoubanMovie(1, "肖申克的救赎", "弗兰克·德拉邦特", "蒂姆·罗宾斯/摩根·弗里曼", "1994-10-14", 9.7, 100));
        movie.add(new DoubanMovie(2, "星际穿越", "克里斯托弗·诺兰", "马修·麦康纳/安妮·海瑟薇", "2014-11-12", 9.4, 1000));
        movie.add(new DoubanMovie(3, "我不是药神", "文牧野", "徐峥/王传君", "2018-07-05", 9.0, 900));
        movie.add(new DoubanMovie(4, "盗梦空间", "克里斯托弗·诺兰", "莱昂纳多·迪卡普里奥/约瑟夫·高登-莱维特", "2010-09-01", 9.4, 2349999));
        movie.add(new DoubanMovie(5, "三傻大闹宝莱坞", "拉吉库马尔··希拉尼", "阿米尔·汗/卡琳娜·卡普尔", "2011-12-08", 9.2, 500));
        String next;
        do {
            DoubanMovie douban = new DoubanMovie();
            System.out.println("--------------电影评分列表----------------");
            System.out.println("序号\t电影名称\t\t导演\t\t主演\t\t评分");
            for (Movie movie1 : movie) {
                douban = (DoubanMovie) movie1;
                douban.getter();
            }
            System.out.println("----------------------------------------");
            Scanner sc = new Scanner(System.in);
            System.out.println("请输入要评分影片的序号：");
            int s = sc.nextInt();
            switch (s) {
                case 1:
                    douban = (DoubanMovie) movie.get(s - 1);

                    System.out.println("请输入评分(1位小数)：");
                    double score_1 = sc.nextDouble();
                    douban.show(score_1);

                    break;
                case 2:
                    douban = (DoubanMovie) movie.get(s - 1);

                    System.out.println("请输入评分(1位小数)：");
                    double score_2 = sc.nextInt();
                    douban.show(score_2);
                    break;
                case 3:
                    douban = (DoubanMovie) movie.get(s - 1);

                    System.out.println("请输入评分(1位小数)：");
                    double score_3 = sc.nextInt();
                    douban.show(score_3);
                    break;
                case 4:
                    douban = (DoubanMovie) movie.get(s - 1);

                    System.out.println("请输入评分(1位小数)：");
                    double score_4 = sc.nextInt();
                    douban.show(score_4);
                    break;
                case 5:
                    douban = (DoubanMovie) movie.get(s - 1);

                    System.out.println("请输入评分(1位小数)：");
                    double score_5 = sc.nextInt();
                    douban.show(score_5);
                    break;
                default:
                    System.out.println("输入有误，请重新输入！！！");
                    break;
            }
            System.out.println("是否继续评分？Y / N ");
            next = sc.next();
            if(Objects.equals(next, "N")){
                System.out.println("--------------电影评分列表----------------");
                System.out.println("序号\t电影名称\t\t导演\t\t主演\t\t评分");
                for (Movie movie1 : movie) {
                    douban = (DoubanMovie) movie1;
                    douban.getter();
                }
                System.out.println("----------------------------------------");return;}
        } while (Objects.equals(next, "Y"));

    }
}
